package com.kmust.dream.wanderingdream.donation.controller;

import java.util.Arrays;
import java.util.Map;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.kmust.dream.wanderingdream.donation.entity.RecipientUserUnionEntity;
import com.kmust.dream.wanderingdream.donation.service.RecipientUserUnionService;
import com.kmust.dream.wanderingdream.comm.utils.PageUtils;
import com.kmust.dream.wanderingdream.comm.utils.R;



/**
 * 
 *
 * @author Leng
 * @email Leng81605@gmail.com
 * @date 2021-07-12 21:35:52
 */
@RestController
@RequestMapping("donation/recipientuserunion")
@Api(tags = "受捐赠者与老师联系")
public class RecipientUserUnionController {
    @Autowired
    private RecipientUserUnionService recipientUserUnionService;

    /**
     * 列表
     */
    @GetMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = recipientUserUnionService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")

    public R info(@PathVariable("id") Integer id){
		RecipientUserUnionEntity recipientUserUnion = recipientUserUnionService.getById(id);

        return R.ok().put("recipientUserUnion", recipientUserUnion);
    }

    /**
     * 保存
     */
    @PostMapping("/save")

    public R save(@RequestBody RecipientUserUnionEntity recipientUserUnion){
		recipientUserUnionService.save(recipientUserUnion);

        return R.ok();
    }

    /**
     * 修改
     */
    @PutMapping("/update")

    public R update(@RequestBody RecipientUserUnionEntity recipientUserUnion){
		recipientUserUnionService.updateById(recipientUserUnion);

        return R.ok();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		recipientUserUnionService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
